FIGURE 1: Liana Example of Encapsulation. // EDITWIND.L - Text editor window. class editwindow: window { window ed; void editwindow () { window (); this.home; this << (ed = new edittext); ed.multiline = true; ed.hscroll = true; ed.vscroll = true; ed.autohscroll = true; ed.autovscroll = true; resize_control (); ed.show; got_focus (); } void editwindow (string title) { editwindow (); this.text = title; } void got_focus () {if (ed) ed.have_focus = true;} void resized (int width, int height) {resize_control ();} void resize_control () { update_status_line_position (); if (ed) { ed.width = this.width + 1; ed.height = this.height + 1; ed.x = -1; ed.y = -1; } } bool status_line_enabled_set (bool status_line_enabled) { window::status_line_enabled_set (status_line_enabled); resize_control (); } }; // FILEWIND.L - Window that displays contents of a text file. class filewindow: textwindow { public: string path; void filewindow (string path) { // Initialize the text window. textwindow (title (path)); // Try to open the file. if (! (file f = fopen (path))) { error ("Unable to open file: "+path); exit (3); } // Read the contents of the file. while (string line = f.readline) this << line; fclose (f); // Display the text read from the file. this.first_row = 0; show (); // Remember the path. filewindow::path = path; } };